package com.mylg.craw.house.lbs.gaode.bean;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.util.StringUtils;

@Getter
@Setter
@ToString
@JsonNaming(PropertyNamingStrategies.LowerCaseStrategy.class)
public class PoiV2Item {
    private String parent;

    private String address;

    private String distance;

    private String pcode;

    private String adCode;

    private String pname;

    private String cityName;

    private String type;

    private String typeCode;

    private String adName;

    private String cityCode;

    private String name;

    private String location;

    private String id;


    public SubWayStation pickUp() {
        SubWayStation subWayStation = new SubWayStation();
        subWayStation.setId(id);
        subWayStation.setAdcode(adCode);
        subWayStation.setAdname(adName);
        subWayStation.setLine(address);
        subWayStation.setName(name);

        if (StringUtils.hasLength(location)) {
            String[] words = location.split(",");
            subWayStation.setLng(words[0]);
            subWayStation.setLat(words[1]);
        }
        return subWayStation;
    }

}
